package com.amado.course28Exception;

public class S06TestApiException {
	public static void main(String[] args) {
		S04ApiRuntimeException apiException=null;
		try {
			String name = null;
			//
//			if(name!=null) {
				addStudent(name);
//			}
		} catch (S04ApiRuntimeException e) {
			e.printStackTrace();
			apiException =e;
		}catch (Exception e) {
			e.printStackTrace();
		}finally {
			
		}
		if(apiException!=null){
			System.out.println(apiException.getErrorMessage());
		}else{
			System.out.println("添加成功");
		}
	}

	public static void addStudent(String student) {
		if (student == null) {
			throw new S04ApiRuntimeException("001", "入参异常");
		}
	}
}
